//
//  ViewController.m
//  UI26_block1
//
//  Created by dllo on 16/8/19.
//  Copyright © 2016年 yh. All rights reserved.
//

#import "ViewController.h"
#import "SecViewController.h"
@interface ViewController ()
@property (strong, nonatomic) IBOutlet UILabel *myLabel;

@end

@implementation ViewController
- (IBAction)push:(id)sender {
    SecViewController *vc = [SecViewController new];
    // 值传递，需要实现Block
    // 告诉Block 该指针为弱引用
    SecViewController * __weak weakVC = vc;
    vc.passTitle = ^(NSString *title) {
        // Block 会对其内部的所有对象进行强引用
        self.myLabel.text = title;
        weakVC.view.backgroundColor = [UIColor redColor];

    };
    [self.navigationController pushViewController:vc animated:YES];
 
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
